#ifndef __zbControl_H
#define __zbControl_H

#include "main.h"


// states of data 
#define	idle			0x01
#define waitingfordata  0x02
#define gotnewdata		0x03
#define processingdata  0x04
#define processingcmd	0x05
#define creatingresp	0x06
#define readytosenddata	0x07
#define sendingdata		0x08
#define	dataerror		0x09

// periph enabled
#define enPWMOUT	0x01
#define enADC		0x02
#define enFQ1		0x04
#define enI2C		0x08
#define enGPIO		0x10
#define enSNAP		0x20  // take snapshot.


// errors, up to 16 stored in status, top 16 bits
#define ERR_SYSTICK 	0x80000000
#define ERR_PWM		 	0x40000000
#define ERR_BADCMD		0x20000000 
#define ERR_I2CTO		0x10000000
#define ERR_PKT_OF		0x8000000 // buffer overflow in circular buffer
#define ERR_CAM			0x4000000
#define ERR_RF			ERR_PKT_OF/2

// all globals used throughout the bot
#define g_VarsSize		104
extern u8 g_Vars[g_VarsSize]; // 100 bytes for our "global" vars
extern u8 debugChar; // debug char
extern globalVars *mygVars;
extern pgloabalVars newg_Vars; 

// define these everywhere so we can access them where 
// needed. they are used in the protocol and the cam module
//extern u32 *frameBufferADDR;
extern uint8_t frame_bufferA[frame_size];
extern uint8_t frame_bufferB[frame_size];


void doTasks(void);
void startupSystems(void);
//void doMotors(void);
//void doI2C(void);
//void gotosleep(void);


#endif
